<TreeSelect
            Style="width:100%;"
            DataSource="treeData"
            @bind-Values="@values"
            Placeholder="Please select"
            ItemValue="item=>item"
            ItemLabel="item=>item.Title"
            AllowClear
            Multiple
            EnableSearch
            TreeDefaultExpandAll
            MatchedStyle="font-weight: bold"
            ChildrenExpression="node=>node.DataItem.Children"
            TitleExpression="node=>node.DataItem.Title"
            TitleTemplate="node=>node.DataItem.Title.ToRenderFragment()"
            KeyExpression="node=>node.DataItem.Key.ToString()"
            IsLeafExpression="node=>node.DataItem.Children==null">
</TreeSelect>

@JsonSerializer.Serialize(values)

@code {
    private IEnumerable<Data> values;

    Data[] treeData = new Data[]
    {
        new()
        {
            Title = "Node1",
            Key = 1,
            Children = new Data[]
            {
                new()
                {
                    Title = "Child Node1",
                    Key = 11,
                },
                new()
                {
                    Title = "Child Node2",
                    Key = 12,
                }
            }
        },
        new()
        {
            Title = "Node2",
            Key = 13,
        },
        new()
        {
            Title="Node3",
            Key=14
        }
    };

  public class Data
  {
    public int Key { get; set; }
    public string Title { get; set; }
    public IEnumerable<Data> Children { get; set; }
  }
}